<%@page import="org.eclipse.football.League"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="Style.css" />
<title>Add Stats</title>
</head>
<body>

<%-- Display username and log out button--%>
<% // make sure username is initialized
String username = (String)request.getSession(true).getAttribute("username");

if(username==null){
	request.getSession().setAttribute("username", "");
	getServletContext().getRequestDispatcher("/stats.jsp").forward(request, response);
}%>

<%
// Get the league from the session*
League league = (League) session.getValue("league");
if(league == null){
	// If the league is null instantiate a new one
	league = new League("league.txt");
}

// Set the league in the session
session.putValue("league", league);
%>

<c:if test="${team == null }">
404? No team associated with this view
</c:if>

<c:if test="${team != null }">
<FORM action="/FootballStats/log_in" method="post">
<H1><c:out value="${team.getName()}" /></H1>
<P> Not <c:out value="${username}" />? 
<INPUT type="submit" name="button" value="Change Account">
</FORM>
<BR>

<c:if test="${off != null }">
<form action="/FootballStats/off_stats" method="post">
Passing Yards: <br><input type="text" name="pass_yds" size="35">
<br>
Passing Touchdowns: <br><input type="text" name="pass_tds" size="35">
<br>
Interceptions: <br><input type="text" name="picks" size="35">
<br>
Passing 2pt Conversions: <br><input type="text" name="pass_2pt" size="35">
<br>
Rushing Yards: <br><input type="text" name="rush_yds" size="35">
<br>
Rushing Touchdowns: <br><input type = "text" name="rush_tds" size="35">
<br>
Rushing 2pt Conversions: <br><input type="text" name="rush_2pt" size="35">
<br>
Receiving Yards: <br><input type="text" name="rec_yds" size="35">
<br>
Receiving Touchdowns: <br><input type="text" name="rec_tds" size="35">
<br>
Receiving 2pt Conversions: <br><input type="text" name="rec_2pt" size="35">
<br>
Fumbles: <br><input type="text" name="fumbles" size="35">
<br>
Return Touchdowns: <br><input type="text" name="ret_tds" size="35">
<br>
<br>
<input type="submit" name="Add Stats" value="Add Stats">
</form>
</c:if>

<c:if test="${def != null }">
<form action="/FootballStats/def_stats" method="post">
Defensive Touchdowns: <br><input type="text" name="def_tds" size="35">
<br>
Defensive Interceptions: <br><input type="text" name="picks" size="35">
<br>
Fumbles Recovered: <br><input type="text" name="fumbles" size="35">
<br>
Sacks: <br><input type="text" name="sacks" size="35">
<br>
Blocked Kicks: <br><input type="text" name="blocks" size="35">
<br>
Safeties: <br><input type = "text" name="safeties" size="35">
<br>
Points Allowed: <br><input type="text" name="pa" size="35">
<br>
Yards Allowed: <br><input type="text" name="ya" size="35">
<br>
<br>
<input type="submit" name="Add Stats" value="Add Stats">
</form>
</c:if>

<c:if test="${kicker != null }">
<form action="/FootballStats/kicker_stats" method="post">
PAT Made: <br><input type="text" name="pat" size="35">
<br>
FG Made (0-39): <br><input type="text" name="fg0" size="35">
<br>
FG Made (40-49): <br><input type="text" name="fg1" size="35">
<br>
FG Made (50+): <br><input type="text" name="fg2" size="35">
<br>
Misses: <br><input type="text" name="misses" size="35">
<br>
<br>
<input type="submit" name="Add Stats" value="Add Stats">
</form>
</c:if>

</c:if>
</body>
</html>